<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	xmlns:s="http://www.springframework.org/security/tags">
	<h:form>
		<p:panel>
			<f:facet name="header">
				<h:outputText value="#{msg['common.lab']}"/>
				<h:outputText value=":&#160;&#160;"/>
				<h:outputText value="#{teacherLabBean.item.lab.name}"/>
			</f:facet>
			<h:panelGrid columns="3">
				<h:outputLabel for="grade" value="#{msg['lab.grade']}"/>
				<h:inputText id="grade" value="#{teacherLabBean.item.grade}"/>
				<h:message for="grade" details="false"/>
				<h:outputLabel for="status" value="#{msg['common.status']}"/>
				<p:selectOneMenu id="status" value="#{teacherLabBean.item.status}">
					<f:selectItems value="#{teacherLabBean.statuses}"
						var="status"  itemValue="#{status}"
						itemLabel="#{msg[status.key]}"/>
				</p:selectOneMenu>
				<h:message for="status" details="false"/>
				<h:commandButton action="#{teacherAttemptBean.update}"
					value="#{msg['action.apply']}"/>
			</h:panelGrid>
			<p:dataTable width="100%" id="attemptsList" rows="20"
				columnClasses="col" value="#{teacherAttemptBean.all}"
				var="attempt">
				<f:facet name="header">
					<h:outputText value="#{msg['lab.attempts']}"/>
				</f:facet>
				<p:column styleClass="userNameCol">
					<f:facet name="header">
						<h:outputText styleClass="headerText"
							value="#{msg['lab.attempt']}"/>
					</f:facet>
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputText value="#{msg['lab.datesent']}"/>
					</f:facet>
					<h:outputText value="#{attempt.dateSent}">
 						<f:convertDateTime pattern="dd.MM.yyyy HH:mm:ss" />
 					</h:outputText>
				</p:column>
				<p:column>
					<f:facet name="header">	
						<h:outputText value="#{msg['lab.datechecked']}"/>
					</f:facet>
					<h:outputText value="#{attempt.dateChecked}">
 						<f:convertDateTime pattern="dd.MM.yyyy HH:mm:ss" />
 					</h:outputText>
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputText value="#{msg['lab.grade']}"/>
					</f:facet>
					<h:outputText value="#{attempt.grade}"/>
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputText value="#{msg['lab.file']}"/>
					</f:facet>
					<h:commandLink action="#{teacherAttemptBean.download}">
						<h:graphicImage value="../images/logo.gif"/>
						<h:outputText value="#{msg['action.downloadlab']}"/>
						<f:setPropertyActionListener
							target="#{teacherAttemptBean.item}"
							value="#{attempt}"/>
					</h:commandLink>
				</p:column>
			</p:dataTable>
			<p:dataTable width="100%" id="issuesList" 
				columnClasses="col" value="#{teacherIssueBean.all}" var="issue"
				columnsWidth="90%,10%">	
				<f:facet name="header">
					<h:outputText value="#{msg['issue.fixbugs']}"/>
				</f:facet>
				<p:column style="width:1px">
					<f:facet name="header">
						<h:commandLink action="#{teacherIssueBean.add}">
							<f:setPropertyActionListener value="#{isuue}"
								target="#{teacherIssueBean.item}"/>
							<h:graphicImage value="/images/add.png"/>
						</h:commandLink>
					</f:facet>
					<h:commandLink action="#{teacherIssueBean.edit}">
						<f:setPropertyActionListener value="#{issue}"
							target="#{teacherIssueBean.item}"/>
						<h:graphicImage value="/images/edit.png"/>
					</h:commandLink>
				</p:column>
				<p:column style="width: 1px">
					<h:commandLink action="#{teacherIssueBean.delete}"
						update="issuesList">
						<f:setPropertyActionListener value="#{issue}"
							target="#{teacherIssueBean.item}"/>
						<h:graphicImage value="/images/delete.png"/>
					</h:commandLink>
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputText value="#{msg['issue.commentary']}"/>
					</f:facet>
					<h:outputText value="#{issue.description}" escape="false"/>
				</p:column>
				<p:column>
					<f:facet name="header">
						<h:outputText value="#{msg['common.status']}"/>
					</f:facet>
					<h:outputText value="#{msg[issue.status.key]}"/>
				</p:column>
			</p:dataTable>
			<h:outputText value="#{teacherLabBean.item.lab.text}" escape="false"/>
			<h:outputText value="#{teacherLabBean.item.variant.text}"
				rendered="#{not empty teacherLabBean.item.variant}" escape="false"/>
		</p:panel>
	</h:form>
</ui:composition>
